<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>welcome to your home</h1>
    <ul id="ul">
    </ul>
    <button id="btn">渲染</button>

    <script>
        let ul = document.querySelector('#ul');
        let btn = document.querySelector('#btn');

        btn.onclick = ()=>{
            fetch('http://localhost:10035/home/list')
            .then(res=>res.json())
            .then(res=>{
                // res.forEach(item => {
                //    let li = document.createElement('li');
                //    li.innerHTML = item;
                //    ul.appendChild(li);
                // });
                ul.innerHTML = res.map(item=>`<li>${item}</li>`).join('');
            });
        }
    </script>
</body>
</html>